import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from "path"
import AutoImport from 'unplugin-auto-import/vite';
// https://vitejs.dev/config/
export default defineConfig({
  server: {
    host: '0.0.0.0', // 解决不能通过ip访问
    port:3001,
    cors: true,
    proxy:{
      '/cpzzapi/': {
        target:`http://60.204.208.233:9103/`,
        changeOrigin: true,
        rewrite: path => path.replace(/^\/cpzzapi/, '')
      },
      '/gis': {
       target: `http://47.98.147.221:18089`,
       changeOrigin: true,
       rewrite: path => path.replace(/^\/gis/, '')
      },
    }
  },
  plugins: [
    vue(),
    AutoImport({
      imports: ['vue',"vue-router"], 
      dts: 'src/auto-import.d.ts',
    }),
  ],
  resolve: {
    alias: {
      "@": resolve(__dirname, "src"),
    }
  }
})
